import java.io.BufferedReader;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class Server
{
  public static void main(String[] args)
  {
    int port = 8088;
    String logFile = "c:\\test.txt";
    try
    {
      ServerSocket s = new ServerSocket(port);
      System.out.println("waiting on port:" + port);

      Socket socket = s.accept();
      InputStream is = socket.getInputStream();
      InputStreamReader isr = new InputStreamReader(is);
      BufferedReader br = new BufferedReader(isr);

      String str = br.readLine();
      PrintWriter loger = new PrintWriter(new FileWriter(logFile, true), true);
      loger.println(str);
    }
    catch (Exception e)
    {
      System.err.println(e);
    }
  }
}